namespace ASPNET.UserControls
{
    using System;
    using System.Diagnostics;
    using System.IO;
    using System.Runtime.CompilerServices;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    public class PickImage : UserControl
    {
        [AccessedThroughProperty("lstImages")]
        private RadioButtonList _lstImages;
        private object designerPlaceholderDeclaration;
        public string ImageDirectory;

        public PickImage()
        {
            base.Init += new EventHandler(this.Page_Init);
            this.ImageDirectory = string.Empty;
        }

        public void Initialize()
        {
            FileInfo[] files = new DirectoryInfo(this.MapPath("~/ACR/Images" + this.ImageDirectory)).GetFiles("*.gif");
            string formatString = "<img src=\"" + this.ResolveUrl("~/ACR/Images") + this.ImageDirectory + "/{0}\" />";
            this.lstImages.DataSource = files;
            this.lstImages.DataTextField = "Name";
            this.lstImages.DataTextFormatString = formatString;
            this.lstImages.DataValueField = "Name";
            this.lstImages.DataBind();
            this.lstImages.Items.Insert(0, new ListItem("none", string.Empty));
            this.lstImages.SelectedIndex = 0;
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
        }

        private void Page_Init(object sender, EventArgs e)
        {
            this.InitializeComponent();
        }

        public string CssClass
        {
            get
            {
                return this.lstImages.CssClass;
            }
            set
            {
                this.lstImages.CssClass = value;
            }
        }

        protected virtual RadioButtonList lstImages
        {
            get
            {
                return this._lstImages;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                if (this._lstImages != null)
                {
                }
                this._lstImages = value;
                if (this._lstImages != null)
                {
                }
            }
        }

        public string SelectedValue
        {
            get
            {
                return this.lstImages.SelectedValue;
            }
            set
            {
                this.lstImages.SelectedValue = value;
            }
        }
    }
}

